﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Gmantis.Controls.DataGrid
{
    internal class DataGridRowCollectionEnumerator : IEnumerator<DataGridRow>, IDisposable, IEnumerator
    {
        // Fields
        private int _current;
        private DataGridRowCollection _rowsCollection;

        // Methods
        internal DataGridRowCollectionEnumerator(DataGridRowCollection rowsCollection)
        {
            this._rowsCollection = rowsCollection;
            this._current = -1;
        }

        public void Dispose()
        {
        }

        public bool MoveNext()
        {
            this._current++;
            return (this._current < this._rowsCollection.Count);
        }

        public void Reset()
        {
            this._current = 0;
        }

        // Properties
        public DataGridRow Current
        {
            get
            {
                return this._rowsCollection[this._current];
            }
        }

        object IEnumerator.Current
        {
            get
            {
                return this._rowsCollection[this._current];
            }
        }
    }
}
